using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : MonoBehaviour
{
    // Start is called before the first frame update
    void Start() { }

    // Update is called once per frame
    void Update() { }

    private void OnCollisionEnter2D(Collision2D other)
    {
        Debug.Log("OnCollisionEnter2D");
        // 设置子弹的碰撞检测运动同样为连续时，子弹能击穿所有障碍，因为引擎在碰撞之前计算了子弹在两帧之间的轨迹
        // Destroy(other.gameObject);
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log("OnTriggerEnter2D");
        // 设置子弹为触发器，碰撞检测运动同样为连续时，触发器并不能击穿所有障碍，是否可以说明，触发器的频率更低
        // Destroy(other.gameObject);
    }

    // private void OnCollisionEnter2D(Collision2D collision)
    // {
    //     Debug.Log("CollisionEnter: " + collision.gameObject.name);
    // }
    // private void OnCollfsionStay2D(Collision2D collision)
    // {
    //     Debug.Log("CollisionStay: " + collision.gameObject.name);
    // }
    // private void OnCollisionExit2D(Collision2D collision)
    // {
    //     Debug.Log("CollisionExit: " + collision.gameObject.name);
    // }
    // private void OnTriggerEnter2D(Collider2D collision)
    // {

    //     Debug.Log("TriggerEnter: " + collision.gameObject.name);
    // }
    // private void OnTriggerStay2D(Collider2D collision)
    // {
    //     Debug.Log("TriggerStay: " + collision.gameObject.name);
    // }
    // private void OnTriggerExit2D(Collider2D collision)
    // {
    //     Debug.Log("TriggerExit: " + collision.gameObject.name);
    // }
}
